<template>
	<el-main>
		<div style="text-align: center;display: inline;font-weight: 600;font-size: 16px">
			{{ form.noticeTitle }}
		</div>
		<el-main>
			<span v-html="form.content"></span>
			<el-form-item label="相关附件" v-if="form.attachId!=''">
				<attach-menu :attachIds="form.attachId" :roleFlag="form.attachRole" :preview="true"></attach-menu>
			</el-form-item>
			<div style="margin-top: 20px;text-align: right;">
				<div style="float: left;">
					【{{ form.noticeTypeName }}】{{ form.createUser }}
				</div>
				<span>点击：{{ form.onclickCount }}次</span><span
				style="margin-left: 20px">发布时间：{{ form.sendTime }}</span>
			</div>
		</el-main>
	</el-main>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'

export default {
	name: 'Notice Details',
	components: {
		AttachMenu,
	},
	data() {
		return {
			form: {
				noticeId: this.$route.query.noticeId,
				noticeTitle: '',
				noticeType: '',
				isTop: '0',
				sendTime: '',
				endTime: '',
				templateType: '',
				attachRole: '1',
				content: '',
				msgType: '',
				attachId: ''
			},
		}
	},
	mounted() {
		this.getMyNoticeById();
	},
	methods: {
		async setNoticeReadStatus() {
			await this.$API.info.notice.setNoticeReadStatus.post({noticeId: this.form.noticeId});
		},
		async getMyNoticeById() {
			let res = await this.$API.info.notice.getMyNoticeById.get({noticeId: this.form.noticeId});
			{
				if (res.code == 200) {
					this.form.noticeId = res.data.noticeId
					this.form.noticeTitle = res.data.noticeTitle
					this.form.noticeTypeName = res.data.noticeTypeName
					this.form.content = res.data.content
					this.form.sendTime = res.data.sendTime
					this.form.onclickCount = res.data.onclickCount
					this.form.createTime = res.data.createTime
					this.form.attachId = res.data.attachId
					this.form.endTime = res.data.endTime
					this.form.templateType = res.data.templateType
					this.form.attachRole = res.data.attachRole
					this.setNoticeReadStatus();
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}

	}

}
</script>

<style>
</style>
